import { Global, Module } from '@nestjs/common';
import { TypegooseModule } from "nestjs-typegoose"
import { QudaotjModel } from './models/qudaotjModel/qudaotjModel';
import { LunboModel } from './models/lunboModel/lunboModel';
import { BaoMinModel } from './models/baominModel/BaoMinModel';
import { QudaobaoModel } from './models/qudaobaoModel/qudaobaoModel';
import { QiyeModel } from './models/qiyeModel/qiyeModel';
import { LanxiModel } from './models/lianxiModel/LanxiModel';
import { IdfaModel } from './models/idfaModel/idfa.models';
import { JobModel } from './models/jobModel/Job.models';
import { UserModel } from './models/userModel/User.models';
import { WebUserModel } from './models/userModel/webUser.models';
import { JihuoModel } from './models/jihuoModel/jihuoModel';

const models = TypegooseModule.forFeature([
    UserModel,
    JobModel,
    WebUserModel,
    QiyeModel,
    LunboModel,
    BaoMinModel,
    LanxiModel,
    QudaobaoModel,
    IdfaModel,
    QudaotjModel,
    JihuoModel,
])

@Global()
@Module({
    imports: [
        TypegooseModule.forRoot(process.env.MONGODB || 'mongodb://127.0.0.1:27017/recruitment', {
            useNewUrlParser: true,
            useUnifiedTopology: true,
            useCreateIndex: true,
            useFindAndModify: true,
        }),
        models
    ],
    controllers: [],
    providers: [],
    exports: [models]
})
export class MongoModule { }
